<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SystemSharp: IEEE754Support.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">SystemSharp
   &#160;<span id="projectnumber">0.3</span>
   </div>
   <div id="projectbrief">A system-level modeling framework for designing real-time embedded systems</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_i_e_e_e754_support_8cs_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Properties</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Events</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">IEEE754Support.cs</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_i_e_e_e754_support_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">using</span> System;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">using</span> System.Collections.Generic;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">using</span> System.Diagnostics;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">using</span> System.IO;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">using</span> System.Linq;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">using</span> System.Text;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="keyword">using</span> SystemSharp.Components;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">using</span> SystemSharp.Meta;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">namespace </span>SystemSharp.DataTypes</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;{</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html">   34</a></span>&#160;    <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    {</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a031017e9255352f0f2cb09ca3787f541">   39</a></span>&#160;        <span class="keyword">public</span> <span class="keywordtype">int</span> ExponentWidth { <span class="keyword">get</span>; <span class="keyword">private</span> set; }</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">   44</a></span>&#160;        <span class="keyword">public</span> <span class="keywordtype">int</span> FractionWidth { <span class="keyword">get</span>; <span class="keyword">private</span> set; }</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a584907aa5a41ffec90f373e8c1471273">   51</a></span>&#160;        <span class="keyword">public</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a584907aa5a41ffec90f373e8c1471273">FloatFormat</a>(<span class="keywordtype">int</span> exponentWidth, <span class="keywordtype">int</span> fractionWidth)</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        {</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;            ExponentWidth = exponentWidth;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;            FractionWidth = fractionWidth;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        }</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="keyword">public</span> <span class="keywordtype">int</span> TotalWidth</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#aea199a1640b232485b1b0951d16bd3af">   61</a></span>&#160;        {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            <span class="keyword">get</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            {</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                <span class="keywordflow">return</span> ExponentWidth + FractionWidth + 1;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;            }</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        }</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keyword">public</span> <span class="keywordtype">int</span> Bias</div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a714d6d57e8201d1bb219735e699a243b">   72</a></span>&#160;        {</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            <span class="keyword">get</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            {</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                <span class="keywordflow">return</span> (1 &lt;&lt; (ExponentWidth - 1)) - 1;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            }</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        }</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a76f608bbe98e20fc14b7bd284587c891">   82</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> readonly <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> SingleFormat = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>(8, 23);</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#af72a42905b95a85f0ff0d8b696aec1e7">   87</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> readonly <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> DoubleFormat = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>(11, 52);</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a18cc608b04efa1bf8b5ec1fb09c8ed0e">   92</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> readonly <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> SingleExtendedFormat = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>(11, 31);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a39d18d4d538db03cc6d83659ff5b2f41">   97</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> readonly <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> DoubleExtendedFormat = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>(15, 63);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    }</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html">  104</a></span>&#160;    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class </span><a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html">IEEE754Support</a></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    {</div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a475f2d4c9422eb7fb90faa26afb4d1c5">  111</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> ulong <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a475f2d4c9422eb7fb90faa26afb4d1c5">Float64ToBits</a>(<span class="keywordtype">double</span> value)</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        {</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            byte[] buf = <span class="keyword">new</span> byte[8];</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;            MemoryStream msw = <span class="keyword">new</span> MemoryStream(buf);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;            BinaryWriter bw = <span class="keyword">new</span> BinaryWriter(msw);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            bw.Write(value);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;            bw.Close();</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            msw.Close();</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            MemoryStream msr = <span class="keyword">new</span> MemoryStream(buf);</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            BinaryReader br = <span class="keyword">new</span> BinaryReader(msr);</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            <span class="keywordflow">return</span> br.ReadUInt64();</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a21855e1d6e97ced230808805e375a767">  129</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a21855e1d6e97ced230808805e375a767">BitsToFloat64</a>(ulong value)</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        {</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            byte[] buf = <span class="keyword">new</span> byte[8];</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;            MemoryStream msw = <span class="keyword">new</span> MemoryStream(buf);</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            BinaryWriter bw = <span class="keyword">new</span> BinaryWriter(msw);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;            bw.Write(value);</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            bw.Close();</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            msw.Close();</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            MemoryStream msr = <span class="keyword">new</span> MemoryStream(buf);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            BinaryReader br = <span class="keyword">new</span> BinaryReader(msr);</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;            <span class="keywordflow">return</span> br.ReadDouble();</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a7b71e67889f15f7f1f172143d9436e37">  149</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a7b71e67889f15f7f1f172143d9436e37">ToFloat</a>(<span class="keyword">this</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> slv, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> fmt)</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        {</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;            <span class="keywordflow">if</span> (slv.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a2b88c122ab31e982a58f2afa18d39283">Size</a> != fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#aea199a1640b232485b1b0951d16bd3af">TotalWidth</a>)</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentException(<span class="stringliteral">&quot;Vector does not match specified floating point format&quot;</span>);</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            slv = slv.ProperValue;</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> mantissa = slv[fmt.FractionWidth - 1, 0];</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> exponent = slv[fmt.FractionWidth + fmt.ExponentWidth - 1, fmt.FractionWidth];</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic.html">StdLogic</a> sign = slv[fmt.FractionWidth + fmt.ExponentWidth];</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;            <span class="keywordtype">int</span> exp = (int)exponent.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a46ff56820cd75d4aa7d0b528c5030382">ULongValue</a> - fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a714d6d57e8201d1bb219735e699a243b">Bias</a>;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;            if (exponent.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#ae699eca1782d336864a8f8314fa0d543">Equals</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a1d929bb3052772e9c890159655b8508b">_0s</a>(fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a031017e9255352f0f2cb09ca3787f541">ExponentWidth</a>)))</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;            {</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                <span class="comment">// denormalized</span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                <span class="keywordtype">long</span> mant = mantissa.LongValue;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                <span class="keywordtype">double</span> result = (double)mant * Math.Pow(2.0, exp - 1);</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            }</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (exponent.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#ae699eca1782d336864a8f8314fa0d543">Equals</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a973135fcd13cde839508b321c0eaa271">_1s</a>(fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a031017e9255352f0f2cb09ca3787f541">ExponentWidth</a>)))</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            {</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                <span class="comment">// Infinity / NaN</span></div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;                <span class="keywordflow">if</span> (mantissa.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#ae699eca1782d336864a8f8314fa0d543">Equals</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a1d929bb3052772e9c890159655b8508b">_0s</a>(fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">FractionWidth</a>)))</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                {</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                    <span class="comment">// infinity</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                    <span class="keywordflow">if</span> (sign == <span class="charliteral">&#39;1&#39;</span>)</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;                        <span class="keywordflow">return</span> double.NegativeInfinity;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                        <span class="keywordflow">return</span> double.PositiveInfinity;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                }</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                <span class="keywordflow">else</span></div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;                {</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                    <span class="comment">// NaN</span></div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                    <span class="keywordflow">return</span> double.NaN;</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                }</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;            }</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;            {</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                <span class="comment">// normalized</span></div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> number = StdLogicVector._1s(1).Concat(mantissa);</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                ulong mant = number.ULongValue;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                <span class="keywordtype">double</span> result = (double)mant * Math.Pow(2.0, exp - fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">FractionWidth</a>);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;                <span class="keywordflow">if</span> (sign == <span class="charliteral">&#39;1&#39;</span>)</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                    result = -result;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            }</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        }</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_type_conversion.html">TypeConversion</a>(typeof(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>), typeof(<span class="keywordtype">float</span>))]</div>
<div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a4fe2a6e0603bbc0cac5440c86d002593">  198</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">float</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a4fe2a6e0603bbc0cac5440c86d002593">ToFloat</a>(<span class="keyword">this</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> slv)</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;        {</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;            <span class="keywordflow">return</span> (<span class="keywordtype">float</span>)ToFloat(slv, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a76f608bbe98e20fc14b7bd284587c891">SingleFormat</a>);</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        }</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_type_conversion.html">TypeConversion</a>(typeof(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>), typeof(<span class="keywordtype">double</span>))]</div>
<div class="line"><a name="l00204"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ae64e8970b63e27f4e5605d39e753cd1b">  204</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ae64e8970b63e27f4e5605d39e753cd1b">ToDouble</a>(<span class="keyword">this</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> slv)</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        {</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;            <span class="keywordflow">return</span> ToFloat(slv, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#af72a42905b95a85f0ff0d8b696aec1e7">DoubleFormat</a>);</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        }</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a29b7eeda54a9683992d088e60ebcadcd">  215</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a29b7eeda54a9683992d088e60ebcadcd">ToSLV</a>(<span class="keyword">this</span> <span class="keywordtype">double</span> value, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> fmt)</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        {</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> sign;</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> exponent;</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> mantissa;</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;            <span class="keywordflow">if</span> (<span class="keywordtype">double</span>.IsInfinity(value))</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;            {</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;                sign = double.IsNegativeInfinity(value) ? (<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>)<span class="stringliteral">&quot;1&quot;</span> : (<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>)<span class="stringliteral">&quot;0&quot;</span>;</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;                exponent = StdLogicVector._1s(fmt.ExponentWidth);</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;                mantissa = StdLogicVector._0s(fmt.FractionWidth);</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;            }</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">double</span>.IsNaN(value))</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;            {</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                sign = (<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>)<span class="stringliteral">&quot;0&quot;</span>;</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;                exponent = StdLogicVector._1s(fmt.ExponentWidth);</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;                mantissa = StdLogicVector._1s(fmt.FractionWidth);</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;            }</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;            {</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;                sign = value &lt; 0.0 ? (<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>)<span class="stringliteral">&quot;1&quot;</span> : (<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>)<span class="stringliteral">&quot;0&quot;</span>;</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;                <span class="keywordtype">double</span> absvalue = Math.Abs(value);</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;                <span class="keywordtype">int</span> exp = 0;</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                <span class="keywordflow">while</span> (absvalue &gt;= 2.0)</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                {</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;                    absvalue *= 0.5;</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                    exp++;</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;                }</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                <span class="keywordflow">while</span> (absvalue &gt; 0.0 &amp;&amp; absvalue &lt; 1.0)</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;                {</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;                    absvalue *= 2.0;</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;                    exp--;</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;                }</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;                <span class="keywordflow">if</span> (absvalue == 0.0)</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;                {</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;                    <span class="keywordflow">return</span> StdLogicVector._0s(fmt.TotalWidth);</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;                }</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;                <span class="keywordflow">else</span> <span class="keywordflow">if</span> (exp &lt;= -fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a714d6d57e8201d1bb219735e699a243b">Bias</a>)</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;                {</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;                    <span class="comment">// denomalized</span></div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;                    exponent = StdLogicVector._0s(fmt.ExponentWidth);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;                    absvalue *= (double)(1L &lt;&lt; (fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">FractionWidth</a>+1));</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;                    <span class="keywordtype">long</span> mant = (long)absvalue;</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;                    mantissa = StdLogicVector.FromLong(mant, fmt.FractionWidth);</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;                }</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;                <span class="keywordflow">else</span></div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;                {</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;                    absvalue -= 1.0;</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;                    absvalue *= (double)(1L &lt;&lt; fmt.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">FractionWidth</a>);</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;                    <span class="keywordtype">long</span> mant = (long)absvalue;</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;                    mantissa = StdLogicVector.FromLong(mant, fmt.FractionWidth);</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;                    exponent = StdLogicVector.FromLong(exp + fmt.Bias, fmt.ExponentWidth);</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;                }</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;            }</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;            <span class="keywordflow">return</span> sign.Concat(exponent.Concat(mantissa));</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        }</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_type_conversion.html">TypeConversion</a>(typeof(<span class="keywordtype">double</span>), typeof(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>))]</div>
<div class="line"><a name="l00276"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ab0bf6faea01b00e6279ab7f2d4eed949">  276</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ab0bf6faea01b00e6279ab7f2d4eed949">ToSLV</a>(<span class="keyword">this</span> <span class="keywordtype">double</span> value)</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;        {</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;            <span class="keywordflow">return</span> ToSLV(value, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#af72a42905b95a85f0ff0d8b696aec1e7">DoubleFormat</a>);</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;        }</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_type_conversion.html">TypeConversion</a>(typeof(<span class="keywordtype">float</span>), typeof(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a>))]</div>
<div class="line"><a name="l00285"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aea39c1162f1f1a547b55ceba7975e426">  285</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">StdLogicVector</a> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aea39c1162f1f1a547b55ceba7975e426">ToSLV</a>(<span class="keyword">this</span> <span class="keywordtype">float</span> value)</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;        {</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;            <span class="keywordflow">return</span> ToSLV(value, <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a76f608bbe98e20fc14b7bd284587c891">SingleFormat</a>);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        }</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;</div>
<div class="line"><a name="l00294"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aa98541982a008cdea71eaf767bd81ad3">  294</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a> <a class="code" href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aa98541982a008cdea71eaf767bd81ad3">GetFloatFormat</a>(<span class="keyword">this</span> <a class="code" href="class_system_sharp_1_1_meta_1_1_type_descriptor.html">TypeDescriptor</a> td)</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;        {</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;            <span class="keywordflow">if</span> (td.<a class="code" href="class_system_sharp_1_1_meta_1_1_type_descriptor.html#a0169e7b6aac9da0659a1bb6b7474cfee">CILType</a>.Equals(typeof(<span class="keywordtype">float</span>)))</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;                <span class="keywordflow">return</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#a76f608bbe98e20fc14b7bd284587c891">SingleFormat</a>;</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;            <span class="keywordflow">else</span> if (td.<a class="code" href="class_system_sharp_1_1_meta_1_1_type_descriptor.html#a0169e7b6aac9da0659a1bb6b7474cfee">CILType</a>.Equals(typeof(<span class="keywordtype">double</span>)))</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;                <span class="keywordflow">return</span> <a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html">FloatFormat</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_float_format.html#af72a42905b95a85f0ff0d8b696aec1e7">DoubleFormat</a>;</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;                <span class="keywordflow">throw</span> <span class="keyword">new</span> NotSupportedException(<span class="stringliteral">&quot;Type &quot;</span> + td + <span class="stringliteral">&quot; is not a floating-point type&quot;</span>);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        }</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    }</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;}</div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_a7b71e67889f15f7f1f172143d9436e37"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a7b71e67889f15f7f1f172143d9436e37">SystemSharp.DataTypes.IEEE754Support.ToFloat</a></div><div class="ttdeci">static double ToFloat(this StdLogicVector slv, FloatFormat fmt)</div><div class="ttdoc">Converts a binary encoding, given as an StdLogicVector with respect to a floating point format to its...</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00149">IEEE754Support.cs:149</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_a714d6d57e8201d1bb219735e699a243b"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#a714d6d57e8201d1bb219735e699a243b">SystemSharp.DataTypes.FloatFormat.Bias</a></div><div class="ttdeci">int Bias</div><div class="ttdoc">Computes the bias value as defined by IEEE754. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00072">IEEE754Support.cs:72</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_a21855e1d6e97ced230808805e375a767"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a21855e1d6e97ced230808805e375a767">SystemSharp.DataTypes.IEEE754Support.BitsToFloat64</a></div><div class="ttdeci">static double BitsToFloat64(ulong value)</div><div class="ttdoc">Converts a binary encoding to a double. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00129">IEEE754Support.cs:129</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_type_conversion_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_type_conversion.html">SystemSharp.Components.TypeConversion</a></div><div class="ttdoc">This attribute indicates that the tagged method performs a type conversion. Calls to the tagges metho...</div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l00452">ComponentsAttributes.cs:452</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html_a46ff56820cd75d4aa7d0b528c5030382"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a46ff56820cd75d4aa7d0b528c5030382">SystemSharp.DataTypes.StdLogicVector.ULongValue</a></div><div class="ttdeci">ulong ULongValue</div><div class="ttdoc">Converts this logic vector to a ulong, assuming a binary integer econding. Bits with value &#39;1&#39; are in...</div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l01624">StdLogicLib.cs:1624</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_a031017e9255352f0f2cb09ca3787f541"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#a031017e9255352f0f2cb09ca3787f541">SystemSharp.DataTypes.FloatFormat.ExponentWidth</a></div><div class="ttdeci">int ExponentWidth</div><div class="ttdoc">The exponent width (in bits). </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00039">IEEE754Support.cs:39</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_a4fe2a6e0603bbc0cac5440c86d002593"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a4fe2a6e0603bbc0cac5440c86d002593">SystemSharp.DataTypes.IEEE754Support.ToFloat</a></div><div class="ttdeci">static float ToFloat(this StdLogicVector slv)</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00198">IEEE754Support.cs:198</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_a584907aa5a41ffec90f373e8c1471273"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#a584907aa5a41ffec90f373e8c1471273">SystemSharp.DataTypes.FloatFormat.FloatFormat</a></div><div class="ttdeci">FloatFormat(int exponentWidth, int fractionWidth)</div><div class="ttdoc">Constructs a floating point format. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00051">IEEE754Support.cs:51</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_a475f2d4c9422eb7fb90faa26afb4d1c5"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a475f2d4c9422eb7fb90faa26afb4d1c5">SystemSharp.DataTypes.IEEE754Support.Float64ToBits</a></div><div class="ttdeci">static ulong Float64ToBits(double value)</div><div class="ttdoc">Converts a double to its raw encoding. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00111">IEEE754Support.cs:111</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html">SystemSharp.DataTypes.StdLogicVector</a></div><div class="ttdoc">Represents a vector of four-valued logic, similiar to IEEE 1164. </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00783">StdLogicLib.cs:783</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_af72a42905b95a85f0ff0d8b696aec1e7"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#af72a42905b95a85f0ff0d8b696aec1e7">SystemSharp.DataTypes.FloatFormat.DoubleFormat</a></div><div class="ttdeci">static readonly FloatFormat DoubleFormat</div><div class="ttdoc">The IEEE754 double format (64 bits in total). </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00087">IEEE754Support.cs:87</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html">SystemSharp.DataTypes.FloatFormat</a></div><div class="ttdoc">This class is used to represent variable floating point formats. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00034">IEEE754Support.cs:34</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_ab0bf6faea01b00e6279ab7f2d4eed949"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ab0bf6faea01b00e6279ab7f2d4eed949">SystemSharp.DataTypes.IEEE754Support.ToSLV</a></div><div class="ttdeci">static StdLogicVector ToSLV(this double value)</div><div class="ttdoc">Converts the value to its IEEE 754 binary encoding as StdLogicVector. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00276">IEEE754Support.cs:276</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html_ae699eca1782d336864a8f8314fa0d543"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#ae699eca1782d336864a8f8314fa0d543">SystemSharp.DataTypes.StdLogicVector.Equals</a></div><div class="ttdeci">override bool Equals(object obj)</div><div class="ttdoc">Two logic vectors are defined to be equal iff they have the same length and are bit-wise identical...</div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00954">StdLogicLib.cs:954</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_aea39c1162f1f1a547b55ceba7975e426"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aea39c1162f1f1a547b55ceba7975e426">SystemSharp.DataTypes.IEEE754Support.ToSLV</a></div><div class="ttdeci">static StdLogicVector ToSLV(this float value)</div><div class="ttdoc">Converts the value to its IEEE 754 binary encoding as StdLogicVector. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00285">IEEE754Support.cs:285</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_a29b7eeda54a9683992d088e60ebcadcd"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#a29b7eeda54a9683992d088e60ebcadcd">SystemSharp.DataTypes.IEEE754Support.ToSLV</a></div><div class="ttdeci">static StdLogicVector ToSLV(this double value, FloatFormat fmt)</div><div class="ttdoc">Converts a double value to its binary encoding, given a floating point format. </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00215">IEEE754Support.cs:215</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_aea199a1640b232485b1b0951d16bd3af"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#aea199a1640b232485b1b0951d16bd3af">SystemSharp.DataTypes.FloatFormat.TotalWidth</a></div><div class="ttdeci">int TotalWidth</div><div class="ttdoc">Computes the total amount of bits which are needed to encode a floating point number of this format...</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00061">IEEE754Support.cs:61</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_a76f608bbe98e20fc14b7bd284587c891"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#a76f608bbe98e20fc14b7bd284587c891">SystemSharp.DataTypes.FloatFormat.SingleFormat</a></div><div class="ttdeci">static readonly FloatFormat SingleFormat</div><div class="ttdoc">The IEEE754 single format (32 bits in total). </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00082">IEEE754Support.cs:82</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_aa98541982a008cdea71eaf767bd81ad3"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#aa98541982a008cdea71eaf767bd81ad3">SystemSharp.DataTypes.IEEE754Support.GetFloatFormat</a></div><div class="ttdeci">static FloatFormat GetFloatFormat(this TypeDescriptor td)</div><div class="ttdoc">Extracts the floating-point format description from the SysDOM type descriptor, given that it actuall...</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00294">IEEE754Support.cs:294</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html">SystemSharp.DataTypes.IEEE754Support</a></div><div class="ttdoc">This class provides various helper methods which convert from IEEE754 floating point number to their ...</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00104">IEEE754Support.cs:104</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_meta_1_1_type_descriptor_html"><div class="ttname"><a href="class_system_sharp_1_1_meta_1_1_type_descriptor.html">SystemSharp.Meta.TypeDescriptor</a></div><div class="ttdoc">Describes a type. </div><div class="ttdef"><b>Definition:</b> <a href="_type_descriptor_8cs_source.html#l00120">TypeDescriptor.cs:120</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html_a2b88c122ab31e982a58f2afa18d39283"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a2b88c122ab31e982a58f2afa18d39283">SystemSharp.DataTypes.StdLogicVector.Size</a></div><div class="ttdeci">int Size</div><div class="ttdoc">Returns the length (i.e. number of bits) of this logic vector. </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00984">StdLogicLib.cs:984</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html_a1d929bb3052772e9c890159655b8508b"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a1d929bb3052772e9c890159655b8508b">SystemSharp.DataTypes.StdLogicVector._0s</a></div><div class="ttdeci">static StdLogicVector _0s(long count)</div><div class="ttdoc">Returns a logic vector which consists of logic &#39;0&#39;s of a specified length </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00816">StdLogicLib.cs:816</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support_html_ae64e8970b63e27f4e5605d39e753cd1b"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_i_e_e_e754_support.html#ae64e8970b63e27f4e5605d39e753cd1b">SystemSharp.DataTypes.IEEE754Support.ToDouble</a></div><div class="ttdeci">static double ToDouble(this StdLogicVector slv)</div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00204">IEEE754Support.cs:204</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_float_format_html_a5e7ca34842a7b0e68d8a367337c4db03"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_float_format.html#a5e7ca34842a7b0e68d8a367337c4db03">SystemSharp.DataTypes.FloatFormat.FractionWidth</a></div><div class="ttdeci">int FractionWidth</div><div class="ttdoc">The mantissa width (in bits). </div><div class="ttdef"><b>Definition:</b> <a href="_i_e_e_e754_support_8cs_source.html#l00044">IEEE754Support.cs:44</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic.html">SystemSharp.DataTypes.StdLogic</a></div><div class="ttdoc">This data type represents a single bit of four-valued logic, similiar to IEEE 1164. </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00192">StdLogicLib.cs:192</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_std_logic_vector_html_a973135fcd13cde839508b321c0eaa271"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_std_logic_vector.html#a973135fcd13cde839508b321c0eaa271">SystemSharp.DataTypes.StdLogicVector._1s</a></div><div class="ttdeci">static StdLogicVector _1s(long count)</div><div class="ttdoc">Returns a logic vector which consists of logic &#39;1&#39;s of a specified length </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l00827">StdLogicLib.cs:827</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_meta_1_1_type_descriptor_html_a0169e7b6aac9da0659a1bb6b7474cfee"><div class="ttname"><a href="class_system_sharp_1_1_meta_1_1_type_descriptor.html#a0169e7b6aac9da0659a1bb6b7474cfee">SystemSharp.Meta.TypeDescriptor.CILType</a></div><div class="ttdeci">Type CILType</div><div class="ttdoc">The underlying CLI type information. </div><div class="ttdef"><b>Definition:</b> <a href="_type_descriptor_8cs_source.html#l00136">TypeDescriptor.cs:136</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_bb5e995590685548b7e11478911ee7c3.html">SystemSharp-Google-SVN</a></li><li class="navelem"><a class="el" href="dir_8deefa4467a62b572b52d238d562b104.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_0e5a72156f8560bbc472a395da2569d6.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_9d3c30b4336bd92c64ccf0aeee487ace.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_487428fe460a800f88fb12ae0b935462.html">DataTypes</a></li><li class="navelem"><a class="el" href="_i_e_e_e754_support_8cs.html">IEEE754Support.cs</a></li>
    <li class="footer">Generated on Thu Dec 26 2013 14:21:39 for SystemSharp by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
